package space.sakana.edusysback.mapper.job;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import space.sakana.edusysback.entity.job.JobAnswer;

@Mapper
public interface JobAnswerMapper {

    @Select("select `id`, `jid`, `uid`, `qid`, `answer`, `score` from jobanswer where `id`=#{id};")
    JobAnswer selectJobAnswerById(int id);

    @Insert("insert into jobanswer(`jid`, `uid`, `qid`, `answer`) values(#{jid}, #{uid}, #{qid}, #{answer});")
    int insertJobAnswer(JobAnswer jobAnswer);

    @Update("update jobanswer set `jid`=#{jid}, `uid`=#{uid}, `qid`=#{qid}, `answer`=#{answer}, `score`=#{score} where `id`=#{id};")
    int updateJobAnswer(JobAnswer jobAnswer);

}
